<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    
    <style>
        .orgC1{width: 30%;}
        .orgC2{width: 70%;}
    </style>
    
    <h:head>
        <script name="jquery/jquery.js" library="primefaces"></script>

        <h:outputStylesheet name="./css/default.css"/>
        <h:outputStylesheet name="./css/cssLayout.css"/>        
        <h:outputScript library="js" name="./jsControles.js"/>
    </h:head>
    
    <h:form id="frmOrganization">
        <p:panel id="panelOrg">
            <p:messages />
        <h:panelGrid columns="2" width="100%" columnClasses="orgC1,orgC2" >
                <h:outputText value="Короткое наименование" />
            <p:inputText value="#{mbVOrganization.newOrganization.name}"
                         maxlength="128" style="width: 97%" required="true">
                <f:validateLength minimum="2" />
            </p:inputText>
            <h:outputText value="Полное наименование" />
            <p:inputText value="#{mbVOrganization.newOrganization.fullName}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="Телефон" />
            <p:inputText value="#{mbVOrganization.newOrganization.phone}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="Эл. почта" />
            <p:inputText value="#{mbVOrganization.newOrganization.email}"
                         maxlength="128" style="width: 97%" />
            <p:outputLabel value="Адрес" for="txtAddress"/>
            <h:panelGroup>
                <p:inputText id="txtAddress" label="Адрес" style="width: 84%"
                             value="#{mbVOrganization.address.toString()}"
                             readonly="true">
                </p:inputText>  
                <p:spacer width="10px" />
                <p:commandButton value="..." styleClass="button"
                                 action="#{mbVOrganization.setAddressOrganization()}"                                 
                                 process="@this">
                    <p:ajax event="dialogReturn" 
                                    listener="#{mbVOrganization.onAddressChosen}"
                                    update=":frmOrganization:txtAddress"/>
                </p:commandButton>
            </h:panelGroup>
            <h:outputText value="ОГРН" />
            <p:inputText value="#{mbVOrganization.newOrganization.ogrn}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="ИНН" />
            <p:inputText value="#{mbVOrganization.newOrganization.inn}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="КПП" />
            <p:inputText value="#{mbVOrganization.newOrganization.kpp}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="Рсчетный счет" />
            <p:inputText value="#{mbVOrganization.newOrganization.rsch}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="Корреспонденский счет" />
            <p:inputText value="#{mbVOrganization.newOrganization.ksch}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="Банк" />
            <p:inputText value="#{mbVOrganization.newOrganization.bank}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="БИК Банка" />
            <p:inputText value="#{mbVOrganization.newOrganization.bik}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="ОКПО" />
            <p:inputText value="#{mbVOrganization.newOrganization.okpo}"
                         maxlength="128" style="width: 97%" />
            <h:outputText value="Упращенный учет" />
            <p:selectBooleanCheckbox value="#{mbVOrganization.newOrganization.nds}" />
            <h:outputText value="Дата регистрации" />
                <p:calendar id="calendar"
                            value="#{mbVOrganization.newOrganization.regDate}" 
                            showOn="button" />
        </h:panelGrid>
        <h:panelGroup layout="block" style="text-align: right">
            <p:commandButton value="Сохранить" 
                             action="#{mbVOrganization.registration()}"
                             update="panelOrg">
            </p:commandButton>
            <p:commandButton value="Отменить" action="#{mbVOrganization.cancel()}"
                             oncomplete="PF('dialogNewOrganization').hide();">
                <p:ajax update="panelOrg" resetValues="true" />
            </p:commandButton>
        </h:panelGroup>            
        </p:panel>
    </h:form>
</html>

